import { dyjHttp as http } from '@/services/http';
import type { ListResult, Limit } from '@/types/api/common';
import type { CourseListParamsDTO, CourseListItem } from '@/types/api/crm-dyj/course';
/**
 * 课程管理
 */

/** 列表 */
export const getList = (payload: { data: CourseListParamsDTO; params: Limit }) =>
  http<ListResult<CourseListItem>, undefined, CourseListParamsDTO>({
    method: 'get',
    url: '/api/admin/courseGetList',
    params: { ...payload.data, ...payload.params }
  });
/** 详情 */
export const getDetail = (params: {id: string}) => http({ url: '/api/admin/getCourse', params });
/** 添加 */
export const add = (data: any) => http({ method: 'post', url: '/api/admin/addCourse', data });
/** 编辑 */
export const edit = (data: any) => http({ method: 'post', url: '/api/admin/updateCourse', data });
/** 删除 */
export const del = (params: {itemId: number}) => http({ method: 'get', url: '/api/admin/deleteCourse', params });
/** 获取链接解析结果 */
export const getAnalResult = (data: any) => http({ method: 'post', url: '/api/admin/videoParsing', data });
/** 上/下架 */
export const shelfCourse = (params: any) => http({ method: 'get', url: '/api/admin/manipulation', params });
